package com.pudu.mydemo.act;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.Button;

import com.pudu.pdrobot.App;
import com.pudutech.pdrobot.R;

/**
 * Created by guiliu on 2016/8/31.
 */
public class AnimatorTest extends AppCompatActivity {
    private Button button1,button2,button3,button4,button5, button8,button9,button10,button11,button12;
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.animator_test);
        button1 = (Button)findViewById(R.id.button);
        button2 = (Button)findViewById(R.id.button3);
        button3 = (Button)findViewById(R.id.button5);
        button4 = (Button)findViewById(R.id.button6);
        button5 = (Button)findViewById(R.id.button7);
        button8 = (Button)findViewById(R.id.button8);
        button9 = (Button)findViewById(R.id.button9);
        button10 = (Button)findViewById(R.id.button10);
        button11 = (Button)findViewById(R.id.button11);
        button12 = (Button)findViewById(R.id.button12);



        button1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                runErrorBroacast(1);
            }
        });
        button2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                runErrorBroacast(2);
            }
        });
        button3.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                runErrorBroacast(3);
            }
        });
        button4.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                runErrorBroacast(4);
            }
        });
        button5.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                runErrorBroacast(4);
            }
        });


        button8.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                runErrorBroacast(5);
            }
        });
        button9.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                runErrorBroacast(6);
            }
        });
        button10.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                runErrorBroacast(7);
            }
        });
        button11.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                runErrorBroacast(8);
            }
        });
        button12.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                runErrorBroacast(9);
            }
        });



    }

    public void runErrorBroacast(int data) {
        Intent intent = new Intent();
        intent.setAction("something_wrong");
        intent.putExtra("status",data);
        App.context().sendBroadcast(intent);
        Log.e("brocast","send brocast");
    }
}
